/*
 * @Author: jiutian
 * @Date: 2023-01-31 11:47:08
 * @LastEditTime: 2023-02-02 13:59:30
 * @LastEditors:
 */
const express = require("express");
const router = express.Router();
const handler = require("../router_handler/entry");
const { validate, Joi } = require("express-validation");

router.post(
  "/entryPwd",
  validate({
    body: Joi.object({
      phoneNumber: Joi.string().required(),
      password: Joi.string().required(),
    }),
  }),
  handler.entryPwd
);
router.get("/getSvgCaptcha", handler.getSvgCaptcha);

router.post(
  "/sendMsg",
  validate({
    body: Joi.object({
      phoneNumber: Joi.string().required(),
    }),
  }),
  handler.sendMsg
);

router.post(
  "/entryPhone",
  validate({
    body: Joi.object({
      phoneNumber: Joi.string().required(),
      smsCode: Joi.string().required(),
    }),
  }),
  handler.entryPhone
);

router.post(
  "/resetPwd",
  validate({
    body: Joi.object({
      phoneNumber: Joi.string().required(),
      password: Joi.string().required(),
    }),
  }),
  handler.resetPwd
);

router.get("/getXlsx", handler.getXlsx);

module.exports = router;
